<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="utf-8" />
   
  <meta name="keywords" content="郑浩枫,周芳怡,咸鱼郑某的博客" />
   
  <meta name="description" content="咸鱼郑某的博客" />
  
  <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1" />
  <title>
    jder.net爬虫 |  岛
  </title>
  <meta name="generator" content="hexo-theme-yilia-plus">
  
  <link rel="shortcut icon" href="/favicon.ico" />
  
  
<link rel="stylesheet" href="/css/main.css">

  
  <script src="https://cdn.jsdelivr.net/npm/pace-js@1.0.2/pace.min.js"></script>
  
  

  

<link rel="alternate" href="/atom.xml" title="岛" type="application/atom+xml">
</head>

</html>

<body>
  <div id="app">
    <main class="content">
      <section class="outer">
  <article id="post-jder.net爬虫" class="article article-type-post" itemscope
  itemprop="blogPost" data-scroll-reveal>

  <div class="article-inner">
    
    <header class="article-header">
       
<h1 class="article-title sea-center" style="border-left:0" itemprop="name">
  jder.net爬虫
</h1>
  

    </header>
    

    
    <div class="article-meta">
      <a href="/2020/jder.net%E7%88%AC%E8%99%AB/" class="article-date">
  <time datetime="2020-04-19T07:34:46.000Z" itemprop="datePublished">2020-04-19</time>
</a>
      
  <div class="article-category">
    <a class="article-category-link" href="/categories/%E7%88%AC%E8%99%AB/">爬虫</a>
  </div>

      
      
<div class="word_count">
    <span class="post-time">
        <span class="post-meta-item-icon">
            <i class="ri-quill-pen-line"></i>
            <span class="post-meta-item-text"> 字数统计:</span>
            <span class="post-count">1.7k字</span>
        </span>
    </span>

    <span class="post-time">
        &nbsp; | &nbsp;
        <span class="post-meta-item-icon">
            <i class="ri-book-open-line"></i>
            <span class="post-meta-item-text"> 阅读时长≈</span>
            <span class="post-count">8分钟</span>
        </span>
    </span>
</div>

      
    </div>
    

    
    
    <div class="tocbot"></div>





    

    
    <div class="article-entry" itemprop="articleBody">
      
      

      
      <h3 id="爬取jder-net的cosplay分区"><a href="#爬取jder-net的cosplay分区" class="headerlink" title="爬取jder.net的cosplay分区"></a>爬取jder.net的cosplay分区</h3><span id="more"></span>
<p>将要迎接高考了，所以这两天学习比较忙，jder.net爬虫可能是这段时间最后一个爬虫项目了。</p>
<p>这次爬虫是比较烦的一次，我们首先来看看他的页面<br><img src="https://web-1253780623.cos.ap-shanghai.myqcloud.com/zhf-blog/images/jder.net%E7%88%AC%E8%99%AB/%E4%B8%BB%E9%A1%B5.png" alt="主页"></p>
<p>虽然看似简单，但是这网页可以说设计的十分麻瓜。</p>
<p>一共179页，观察网页就可以发现规律<br>页面均为<br><code>http://www.jder.net/cosplay/page/*</code></p>
<p>图集均为<br><code>http://www.jder.net/cosplay/*.html</code></p>
<p><img src="https://web-1253780623.cos.ap-shanghai.myqcloud.com/zhf-blog/images/jder.net%E7%88%AC%E8%99%AB/%E9%A1%B5%E9%9D%A22.png" alt="所有页码"></p>
<p>图集内部<br>图片URL均为<br><code>http://img.jder.net/wp-content/uploads/*</code><br>或<br><code>http://www.jder.net/wp-content/uploads/*</code><br><img src="https://web-1253780623.cos.ap-shanghai.myqcloud.com/zhf-blog/images/jder.net%E7%88%AC%E8%99%AB/%E5%9B%BE%E9%9B%86%E5%86%85%E9%83%A8.png" alt="图集内部"></p>
<p>这样我们可以很简单的写出爬虫</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br></pre></td><td class="code"><pre><code class="hljs plain"> # 爬取所有图集<br>for num in range(1, 180):  <br>    print(num)  <br>    page_url &#x3D; &quot;http:&#x2F;&#x2F;www.jder.net&#x2F;cosplay&#x2F;page&#x2F;&quot; + str(num)  <br>    response &#x3D; requests.get(page_url)  <br>    response.encoding &#x3D; &#39;utf-8&#39;  <br>  html &#x3D; response.text  <br>    soup &#x3D; BeautifulSoup(html, &quot;html.parser&quot;)  <br>    a_link_all &#x3D; soup.find_all(&#39;a&#39;)  <br>    group_list_url &#x3D; []  <br>    for item1 in a_link_all:  <br>        all_a_url &#x3D; item1.get(&quot;href&quot;)  <br>        if str(all_a_url).find(&quot;http:&#x2F;&#x2F;www.jder.net&#x2F;cosplay&#x2F;&quot;) !&#x3D; -1 and str(all_a_url).find(&quot;?post&quot;) &#x3D;&#x3D; -1 :  <br>            if not (all_a_url in group_list_url):  <br>                group_list_url.append(all_a_url)  <br>                print(all_a_url)<br></code></pre></td></tr></table></figure>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br></pre></td><td class="code"><pre><code class="hljs plain">  # 进入图集下载  <br>down_img_url &#x3D; []  # 已经下载的URL  <br>for item2 in group_list_url:  <br>    print(&quot;进入图集&quot; + item2)  <br>    img_group &#x3D; img_group + 1 # 图集编号自增  <br>  img_num &#x3D; 0 # 图片编号初始化  <br>  try:  <br>        response &#x3D; requests.get(item2,timeout&#x3D;10)  <br>    except requests.exceptions.RequestException as e:  <br>        print(e)  <br>    response.encoding &#x3D; &#39;utf-8&#39;  <br>  html &#x3D; response.text  <br>    soup &#x3D; BeautifulSoup(html, &quot;html.parser&quot;)  <br>    img_link_all &#x3D; soup.find_all(&#39;img&#39;)  <br>    for item3 in img_link_all:  <br>        img_url &#x3D; item3.get(&#39;src&#39;)  <br>        if str(img_url).find(&quot;http:&#x2F;&#x2F;img.jder.net&#x2F;wp-content&#x2F;uploads&#x2F;&quot;) !&#x3D; -1 and str(img_url) !&#x3D; &quot;http:&#x2F;&#x2F;img.jder.net&#x2F;wp-content&#x2F;uploads&#x2F;bfi_thumb&#x2F;5f5ce72f94bc47dce1a743b480b9a63c-6uebxvpkmpkkfcmh65imn1pkml0nariv5f12hhovy8b.png&quot; and not(img_url in down_img_url):  <br>	          ## 下载<br></code></pre></td></tr></table></figure>

<p>但是没有想的这么简单。<br>后来发现这个网站只要关闭了主页，就不可能打开图片<br><img src="https://web-1253780623.cos.ap-shanghai.myqcloud.com/zhf-blog/images/jder.net%E7%88%AC%E8%99%AB/%E5%9B%BE%E7%89%87403.png" alt="图片403"></p>
<p>起初我以为通过cookie验证的，后来在另一个浏览器模拟出cookie后仍然不能访问图片。我又进行了各种尝试，均不能解决问题。<br><img src="https://web-1253780623.cos.ap-shanghai.myqcloud.com/zhf-blog/images/jder.net%E7%88%AC%E8%99%AB/%E6%B7%BB%E5%8A%A0cookie.png" alt="添加cookie"></p>
<p>似乎到这里已经没路了，但是！</p>
<iframe frameborder="no" border="0" marginwidth="0" marginheight="0" width=330 height=86 src="//music.163.com/outchain/player?type=2&id=489929&auto=1&height=66"></iframe>

<p>我发现在网站主页打开的情况下，可以通过迅雷来下载图片<br><img src="https://web-1253780623.cos.ap-shanghai.myqcloud.com/zhf-blog/images/jder.net%E7%88%AC%E8%99%AB/%E8%BF%85%E9%9B%B7%E4%B8%8B%E8%BD%BD.png" alt="下载图片"><br>通过对迅雷的抓包，啥都没发现，不过这不是最重要的，我们转变思路，改为获取所有图片的URL</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br><span class="line">36</span><br><span class="line">37</span><br><span class="line">38</span><br><span class="line">39</span><br><span class="line">40</span><br><span class="line">41</span><br><span class="line">42</span><br><span class="line">43</span><br><span class="line">44</span><br><span class="line">45</span><br><span class="line">46</span><br><span class="line">47</span><br><span class="line">48</span><br><span class="line">49</span><br><span class="line">50</span><br><span class="line">51</span><br><span class="line">52</span><br></pre></td><td class="code"><pre><code class="hljs plain">import requests  <br>from bs4 import BeautifulSoup  <br>import urllib.request  <br>  <br>img_group &#x3D; 25865 # 初始图集编号  <br># 获取所有图集  <br>for num in range(1, 176):  <br>    print(num)  <br>    page_url &#x3D; &quot;http:&#x2F;&#x2F;www.jder.net&#x2F;cosplay&#x2F;page&#x2F;&quot; + str(num)  <br>    response &#x3D; requests.get(page_url)  <br>    response.encoding &#x3D; &#39;utf-8&#39;  <br>  html &#x3D; response.text  <br>    soup &#x3D; BeautifulSoup(html, &quot;html.parser&quot;)  <br>    a_link_all &#x3D; soup.find_all(&#39;a&#39;)  <br>    group_list_url &#x3D; []  <br>    for item1 in a_link_all:  <br>        all_a_url &#x3D; item1.get(&quot;href&quot;)  <br>        if str(all_a_url).find(&quot;http:&#x2F;&#x2F;www.jder.net&#x2F;cosplay&#x2F;&quot;) !&#x3D; -1 and str(all_a_url).find(&quot;?post&quot;) &#x3D;&#x3D; -1 :  <br>            if not (all_a_url in group_list_url):  <br>                group_list_url.append(all_a_url)  <br>                print(all_a_url)  <br>    # 进入图集下载  <br>down_img_url &#x3D; []  # 已经下载的URL  <br>for item2 in group_list_url:  <br>    print(&quot;进入图集&quot; + item2)  <br>    img_group &#x3D; img_group + 1 # 图集编号自增  <br>  img_num &#x3D; 0 # 图片编号初始化  <br>  try:  <br>        response &#x3D; requests.get(item2,timeout&#x3D;10)  <br>    except requests.exceptions.RequestException as e:  <br>        print(e)  <br>    response.encoding &#x3D; &#39;utf-8&#39;  <br>  html &#x3D; response.text  <br>    soup &#x3D; BeautifulSoup(html, &quot;html.parser&quot;)  <br>    img_link_all &#x3D; soup.find_all(&#39;img&#39;)  <br>    for item3 in img_link_all:  <br>        img_url &#x3D; item3.get(&#39;src&#39;)  <br>        if str(img_url).find(&quot;http:&#x2F;&#x2F;img.jder.net&#x2F;wp-content&#x2F;uploads&#x2F;&quot;) !&#x3D; -1 and str(img_url) !&#x3D; &quot;http:&#x2F;&#x2F;img.jder.net&#x2F;wp-content&#x2F;uploads&#x2F;bfi_thumb&#x2F;5f5ce72f94bc47dce1a743b480b9a63c-6uebxvpkmpkkfcmh65imn1pkml0nariv5f12hhovy8b.png&quot; and not(img_url in down_img_url):  <br>            txt &#x3D; img_url  <br>            print(txt)  <br>            result2txt &#x3D; str(txt)  # data是前面运行出的数据，先将其转为字符串才能写入  <br>  with open(&#39;结果.txt&#39;, &#39;a&#39;) as file_handle:  # .txt可以不自己新建,代码会自动新建  <br>  file_handle.write(result2txt)  # 写入  <br>  file_handle.write(&#39;\n&#39;)  # 有时放在循环里面需要自动转行，不然会覆盖上一条数据  <br>  <br>  if str(img_url).find(&quot;http:&#x2F;&#x2F;www.jder.net&#x2F;wp-content&#x2F;uploads&#x2F;&quot;) !&#x3D; -1 and str(img_url) !&#x3D; &quot;http:&#x2F;&#x2F;img.jder.net&#x2F;wp-content&#x2F;uploads&#x2F;bfi_thumb&#x2F;5f5ce72f94bc47dce1a743b480b9a63c-6uebxvpkmpkkfcmh65imn1pkml0nariv5f12hhovy8b.png&quot; and not(img_url in down_img_url):  <br>            txt &#x3D; img_url  <br>            print(txt)  <br>            result2txt &#x3D; str(txt)  # data是前面运行出的数据，先将其转为字符串才能写入  <br>  with open(&#39;结果.txt&#39;, &#39;a&#39;) as file_handle:  # .txt可以不自己新建,代码会自动新建  <br>  file_handle.write(result2txt)  # 写入  <br>  file_handle.write(&#39;\n&#39;)  # 有时放在循环里面需要自动转行，不然会覆盖上一条数据<br></code></pre></td></tr></table></figure>

<p>这时候又出问题了，当遍历图集<br><code>for num in range(1, 176):  </code><br>的时候，发现当页数超过5页，就会出现页面图片抓取莫名的减少<br><img src="https://web-1253780623.cos.ap-shanghai.myqcloud.com/zhf-blog/images/jder.net%E7%88%AC%E8%99%AB/%E6%95%B0%E9%87%8F%E5%87%8F%E5%B0%91.png" alt="数量减少"></p>
<p>研究了许久，还是没找出原因，但是不要紧，我们只要使用基于浏览器的爬虫就可以解决这个问题，通过尝试，发现“八爪鱼”软件可以完成这项工作<br><img src="https://web-1253780623.cos.ap-shanghai.myqcloud.com/zhf-blog/images/jder.net%E7%88%AC%E8%99%AB/%E5%85%AB%E7%88%AA%E9%B1%BC.png" alt="八爪鱼"></p>
<p>我们通过Python爬取所有图集链接</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br></pre></td><td class="code"><pre><code class="hljs plain">import requests  <br>from bs4 import BeautifulSoup  <br>import urllib.request  <br>#获取所有URL  <br># 获取所有图集  <br>for num in range(1, 180):  <br>    print(num)  <br>    page_url &#x3D; &quot;http:&#x2F;&#x2F;www.jder.net&#x2F;cosplay&#x2F;page&#x2F;&quot; + str(num)  <br>    i &#x3D; 0  <br>  while i &lt; 10:  <br>        try:  <br>            response &#x3D; requests.get(page_url, timeout&#x3D;5)  <br>            response.encoding &#x3D; &#39;utf-8&#39;  <br>  html &#x3D; response.text  <br>            break;  <br>        except requests.exceptions.RequestException:  <br>            i +&#x3D; 1  <br>  soup &#x3D; BeautifulSoup(html, &quot;html.parser&quot;)  <br>    a_link_all &#x3D; soup.find_all(&#39;a&#39;)  <br>    group_list_url &#x3D; []  <br>    for item1 in a_link_all:  <br>        all_a_url &#x3D; item1.get(&quot;href&quot;)  <br>        if str(all_a_url).find(&quot;http:&#x2F;&#x2F;www.jder.net&#x2F;cosplay&#x2F;&quot;) !&#x3D; -1 and str(all_a_url).find(&quot;?post&quot;) &#x3D;&#x3D; -1 :  <br>            if not (all_a_url in group_list_url):  <br>                txt &#x3D; all_a_url  <br>                print(txt)  <br>                result2txt &#x3D; str(txt)  # data是前面运行出的数据，先将其转为字符串才能写入  <br>  with open(&#39;结果.txt&#39;, &#39;a&#39;) as file_handle:  # .txt可以不自己新建,代码会自动新建  <br>  file_handle.write(result2txt)  # 写入  <br>  file_handle.write(&#39;\n&#39;)  # 有时放在循环里面需要自动转行，不然会覆盖上一条数据<br></code></pre></td></tr></table></figure>

<p>注意：在使用<code> requests.get(page_url)</code>请求HTML网页时，有时相应时间会非常的长，非常影响效率，我们可以使用<code>timeout=time</code>来设置超时时间</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br></pre></td><td class="code"><pre><code class="hljs plain">while i &lt; 10:  #10次还存在异常就跳过<br>    try:  #可能有异常的语句<br>        response &#x3D; requests.get(page_url, timeout&#x3D;5)  <br>        response.encoding &#x3D; &#39;utf-8&#39;  <br>  html &#x3D; response.text  <br>        break;  #如果没有异常就结束while语句<br>    except requests.exceptions.RequestException:  <br>        i +&#x3D; 1 #出现异常就自增<br></code></pre></td></tr></table></figure>

<p>通过在服务器上配置八爪鱼，我们能很方便的获取到所有图片链接，只不过有点慢而已。</p>
<p><img src="https://web-1253780623.cos.ap-shanghai.myqcloud.com/zhf-blog/images/jder.net%E7%88%AC%E8%99%AB/%E5%85%AB%E7%88%AA%E9%B1%BC2.png" alt="八爪鱼"></p>
<p>获取到的数据<br><img src="https://web-1253780623.cos.ap-shanghai.myqcloud.com/zhf-blog/images/jder.net%E7%88%AC%E8%99%AB/%E6%95%B0%E6%8D%AE.png" alt="获取到的数据"></p>
<p>最后我们通过迅雷下载就行了，但是一次性下载太多图片会使服务器吧我们IP加入黑名单，所以我们还需要通过代理来下载<br><img src="https://web-1253780623.cos.ap-shanghai.myqcloud.com/zhf-blog/images/jder.net%E7%88%AC%E8%99%AB/%E4%BB%A3%E7%90%86.png" alt="代理工具"></p>
<p>另外迅雷一次性添加过多图片可能会发行图片数量不对，所以我们还要分批进行下载，建议一次性下载1000张左右。</p>

      
      <!-- reward -->
      
      <div id="reward-btn">
        打赏
      </div>
      
    </div>
    
    
      <!-- copyright -->
      
        <div class="declare">
          <ul class="post-copyright">
            <li>
              <i class="ri-copyright-line"></i>
              <strong>版权声明： </strong s>
              本博客所有文章除特别声明外，均采用 <a href="https://www.apache.org/licenses/LICENSE-2.0.html" rel="external nofollow"
                target="_blank">Apache License 2.0</a> 许可协议。转载请注明出处！
            </li>
          </ul>
        </div>
        
    <footer class="article-footer">
      
          
<div class="share-btn">
      <span class="share-sns share-outer">
        <i class="ri-share-forward-line"></i>
        分享
      </span>
      <div class="share-wrap">
        <i class="arrow"></i>
        <div class="share-icons">
          
          <a class="weibo share-sns" href="javascript:;" data-type="weibo">
            <i class="ri-weibo-fill"></i>
          </a>
          <a class="weixin share-sns wxFab" href="javascript:;" data-type="weixin">
            <i class="ri-wechat-fill"></i>
          </a>
          <a class="qq share-sns" href="javascript:;" data-type="qq">
            <i class="ri-qq-fill"></i>
          </a>
          <a class="douban share-sns" href="javascript:;" data-type="douban">
            <i class="ri-douban-line"></i>
          </a>
          <!-- <a class="qzone share-sns" href="javascript:;" data-type="qzone">
            <i class="icon icon-qzone"></i>
          </a> -->
          
          <a class="facebook share-sns" href="javascript:;" data-type="facebook">
            <i class="ri-facebook-circle-fill"></i>
          </a>
          <a class="twitter share-sns" href="javascript:;" data-type="twitter">
            <i class="ri-twitter-fill"></i>
          </a>
          <a class="google share-sns" href="javascript:;" data-type="google">
            <i class="ri-google-fill"></i>
          </a>
        </div>
      </div>
</div>

<div class="wx-share-modal">
    <a class="modal-close" href="javascript:;"><i class="ri-close-circle-line"></i></a>
    <p>扫一扫，分享到微信</p>
    <div class="wx-qrcode">
      <img src="//api.qrserver.com/v1/create-qr-code/?size=150x150&data=https://zhfhz.gitee.io/2020/jder.net%E7%88%AC%E8%99%AB/" alt="微信分享二维码">
    </div>
</div>

<div id="share-mask"></div>
      
      
  <ul class="article-tag-list" itemprop="keywords"><li class="article-tag-list-item"><a class="article-tag-list-link" href="/tags/%E6%8A%80%E6%9C%AF/" rel="tag">技术</a></li><li class="article-tag-list-item"><a class="article-tag-list-link" href="/tags/%E7%88%AC%E8%99%AB/" rel="tag">爬虫</a></li></ul>


    </footer>

  </div>

  
  
  <nav class="article-nav">
    
      <a href="/2020/Linux%E6%9B%B4%E6%96%B0Python%E7%89%88%E6%9C%AC/" class="article-nav-link">
        <strong class="article-nav-caption">上一篇</strong>
        <div class="article-nav-title">
          
            Linux更新Python版本
          
        </div>
      </a>
    
    
      <a href="/2020/%E5%85%B3%E4%BA%8E%E7%83%AD%E7%82%B9%E6%96%B0%E9%97%BB/" class="article-nav-link">
        <strong class="article-nav-caption">下一篇</strong>
        <div class="article-nav-title">关于热点新闻</div>
      </a>
    
  </nav>


  

  
  
<!-- valine评论 -->
<div id="vcomments-box">
    <div id="vcomments">
    </div>
</div>
<script src="//cdn1.lncld.net/static/js/3.0.4/av-min.js"></script>
<script src='https://cdn.jsdelivr.net/npm/valine@1.3.10/dist/Valine.min.js'></script>
<script>
    new Valine({
        el: '#vcomments',
        app_id: 'QExPaN3yEdYGXDLijnPKdTc8-MdYXbMMI',
        app_key: 'kyQzz6yRJkdRHcMm0tpOvSYY',
        path: window.location.pathname,
        notify: 'true',
        verify: 'false',
        avatar: 'mp',
        placeholder: '给我的文章加点评论吧~',
        recordIP: true
    });
    const infoEle = document.querySelector('#vcomments .info');
    if (infoEle && infoEle.childNodes && infoEle.childNodes.length > 0) {
        infoEle.childNodes.forEach(function (item) {
            item.parentNode.removeChild(item);
        });
    }
</script>
<style>
    #vcomments-box {
        padding: 5px 30px;
    }

    @media screen and (max-width: 800px) {
        #vcomments-box {
            padding: 5px 0px;
        }
    }

    #vcomments-box #vcomments {
        background-color: #fff;
    }

    .v .vlist .vcard .vh {
        padding-right: 20px;
    }

    .v .vlist .vcard {
        padding-left: 10px;
    }
</style>

  

  
  
  

</article>
</section>
      <footer class="footer">
  <div class="outer">
    <ul class="list-inline">
      <li>
        &copy;
        2020-2021
        ZHF
      </li>
      <li>
        
        Powered by
        
        
        <a href="https://hexo.io" target="_blank">Hexo</a> Theme <a href="https://github.com/Shen-Yu/hexo-theme-ayer" target="_blank">Ayer</a>
        
      </li>
    </ul>
    <ul class="list-inline">
      <li>
        
        
        <span>
  <i>PV:<span id="busuanzi_value_page_pv"></span></i>
  <i>UV:<span id="busuanzi_value_site_uv"></span></i>
</span>
        
      </li>
      
      <li>
        <!-- cnzz统计 -->
        
        <script type="text/javascript" src=''></script>
        
      </li>
    </ul>
  </div>
</footer>
      <div class="to_top">
        <div class="totop" id="totop">
  <i class="ri-arrow-up-line"></i>
</div>
      </div>
    </main>
    <aside class="sidebar">
      <button class="navbar-toggle"></button>
<nav class="navbar">
  
  <div class="logo">
    <a href="/"><img src="/images/ayer-side.svg" alt="岛"></a>
  </div>
  
  <ul class="nav nav-main">
    
    <li class="nav-item">
      <a class="nav-item-link" href="/">主页</a>
    </li>
    
    <li class="nav-item">
      <a class="nav-item-link" href="/archives">归档</a>
    </li>
    
    <li class="nav-item">
      <a class="nav-item-link" href="/categories">分类</a>
    </li>
    
    <li class="nav-item">
      <a class="nav-item-link" href="/tags">标签</a>
    </li>
    
    <li class="nav-item">
      <a class="nav-item-link" href="/tags/%E6%97%85%E8%A1%8C/">旅行</a>
    </li>
    
    <li class="nav-item">
      <a class="nav-item-link" target="_blank" rel="noopener" href="https://500px.me/ZHFHZ">摄影</a>
    </li>
    
    <li class="nav-item">
      <a class="nav-item-link" href="/2019/about">关于我</a>
    </li>
    
  </ul>
</nav>
<nav class="navbar navbar-bottom">
  <ul class="nav">
    <li class="nav-item">
      
      <a class="nav-item-link nav-item-search"  title="Search">
        <i class="ri-search-line"></i>
      </a>
      
      
      <a class="nav-item-link" target="_blank" href="/atom.xml" title="RSS Feed">
        <i class="ri-rss-line"></i>
      </a>
      
    </li>
  </ul>
</nav>
<div class="search-form-wrap">
  <div class="local-search local-search-plugin">
  <input type="search" id="local-search-input" class="local-search-input" placeholder="Search...">
  <div id="local-search-result" class="local-search-result"></div>
</div>
</div>
    </aside>
    <div id="mask"></div>

<!-- #reward -->
<div id="reward">
  <span class="close"><i class="ri-close-line"></i></span>
  <p class="reward-p"><i class="ri-cup-line"></i>请我喝杯咖啡吧~</p>
  <div class="reward-box">
    
    <div class="reward-item">
      <img class="reward-img" src="/images/alipay.jpg">
      <span class="reward-type">支付宝</span>
    </div>
    
    
    <div class="reward-item">
      <img class="reward-img" src="/images/wechat.jpg">
      <span class="reward-type">微信</span>
    </div>
    
  </div>
</div>
    
<script src="/js/jquery-2.0.3.min.js"></script>


<script src="/js/share.js"></script>


<script src="/js/lazyload.min.js"></script>


<script>
  try {
    var typed = new Typed("#subtitle", {
      strings: ['面朝大海，春暖花开', '愿你一生努力，一生被爱', '想要的都拥有，得不到的都释怀'],
      startDelay: 0,
      typeSpeed: 200,
      loop: true,
      backSpeed: 100,
      showCursor: true
    });
  } catch (err) {
  }

</script>




<script src="/js/tocbot.min.js"></script>

<script>
  // Tocbot_v4.7.0  http://tscanlin.github.io/tocbot/
  tocbot.init({
    tocSelector: '.tocbot',
    contentSelector: '.article-entry',
    headingSelector: 'h1, h2, h3, h4, h5, h6',
    hasInnerContainers: true,
    scrollSmooth: true,
    scrollContainer: 'main',
    positionFixedSelector: '.tocbot',
    positionFixedClass: 'is-position-fixed',
    fixedSidebarOffset: 'auto',
    onClick: (e) => {
      $('.toc-link').removeClass('is-active-link');
      $(`a[href=${e.target.hash}]`).addClass('is-active-link');
      $(e.target.hash).scrollIntoView();
      return false;
    }
  });
</script>



<script src="https://cdn.jsdelivr.net/npm/jquery-modal@0.9.2/jquery.modal.min.js"></script>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/jquery-modal@0.9.2/jquery.modal.min.css">
<script src="https://cdn.jsdelivr.net/npm/justifiedGallery@3.7.0/dist/js/jquery.justifiedGallery.min.js"></script>

<script src="/js/ayer.js"></script>



<!-- Root element of PhotoSwipe. Must have class pswp. -->
<div class="pswp" tabindex="-1" role="dialog" aria-hidden="true">

    <!-- Background of PhotoSwipe. 
         It's a separate element as animating opacity is faster than rgba(). -->
    <div class="pswp__bg"></div>

    <!-- Slides wrapper with overflow:hidden. -->
    <div class="pswp__scroll-wrap">

        <!-- Container that holds slides. 
            PhotoSwipe keeps only 3 of them in the DOM to save memory.
            Don't modify these 3 pswp__item elements, data is added later on. -->
        <div class="pswp__container">
            <div class="pswp__item"></div>
            <div class="pswp__item"></div>
            <div class="pswp__item"></div>
        </div>

        <!-- Default (PhotoSwipeUI_Default) interface on top of sliding area. Can be changed. -->
        <div class="pswp__ui pswp__ui--hidden">

            <div class="pswp__top-bar">

                <!--  Controls are self-explanatory. Order can be changed. -->

                <div class="pswp__counter"></div>

                <button class="pswp__button pswp__button--close" title="Close (Esc)"></button>

                <button class="pswp__button pswp__button--share" style="display:none" title="Share"></button>

                <button class="pswp__button pswp__button--fs" title="Toggle fullscreen"></button>

                <button class="pswp__button pswp__button--zoom" title="Zoom in/out"></button>

                <!-- Preloader demo http://codepen.io/dimsemenov/pen/yyBWoR -->
                <!-- element will get class pswp__preloader--active when preloader is running -->
                <div class="pswp__preloader">
                    <div class="pswp__preloader__icn">
                        <div class="pswp__preloader__cut">
                            <div class="pswp__preloader__donut"></div>
                        </div>
                    </div>
                </div>
            </div>

            <div class="pswp__share-modal pswp__share-modal--hidden pswp__single-tap">
                <div class="pswp__share-tooltip"></div>
            </div>

            <button class="pswp__button pswp__button--arrow--left" title="Previous (arrow left)">
            </button>

            <button class="pswp__button pswp__button--arrow--right" title="Next (arrow right)">
            </button>

            <div class="pswp__caption">
                <div class="pswp__caption__center"></div>
            </div>

        </div>

    </div>

</div>

<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/photoswipe@4.1.3/dist/photoswipe.min.css">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/photoswipe@4.1.3/dist/default-skin/default-skin.min.css">
<script src="https://cdn.jsdelivr.net/npm/photoswipe@4.1.3/dist/photoswipe.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/photoswipe@4.1.3/dist/photoswipe-ui-default.min.js"></script>

<script>
    function viewer_init() {
        let pswpElement = document.querySelectorAll('.pswp')[0];
        let $imgArr = document.querySelectorAll(('.article-entry img:not(.reward-img)'))

        $imgArr.forEach(($em, i) => {
            $em.onclick = () => {
                // slider展开状态
                // todo: 这样不好，后面改成状态
                if (document.querySelector('.left-col.show')) return
                let items = []
                $imgArr.forEach(($em2, i2) => {
                    let img = $em2.getAttribute('data-idx', i2)
                    let src = $em2.getAttribute('data-target') || $em2.getAttribute('src')
                    let title = $em2.getAttribute('alt')
                    // 获得原图尺寸
                    const image = new Image()
                    image.src = src
                    items.push({
                        src: src,
                        w: image.width || $em2.width,
                        h: image.height || $em2.height,
                        title: title
                    })
                })
                var gallery = new PhotoSwipe(pswpElement, PhotoSwipeUI_Default, items, {
                    index: parseInt(i)
                });
                gallery.init()
            }
        })
    }
    viewer_init()
</script>




<script src="/js/busuanzi-2.3.pure.min.js"></script>



<script type="text/javascript" src="https://js.users.51.la/20544303.js"></script>

    
  </div>
</body>

</html>